use Dosvid
go

if exists(select 1
		  from sysobjects
		  where name = 'Employer_ContactPersons')
  drop table Employer_ContactPersons
go

create table Employer_ContactPersons
(
  Id int identity(1,1) not null,
  EmployerId int not null,
  CandidatID int not null
)  
go

alter table Employer_ContactPersons add constraint PK_Employer_ContactPersons_ID primary key(Id) 
go


alter table Employer_ContactPersons add constraint FK_Employer_ContactPersons_Employers_EmployerID 
      foreign key (EmployerId) references Employers(Id) on delete cascade
go


alter table Employer_ContactPersons add constraint FK_Employer_ContactPersons_Candidates_CandidatId 
      foreign key (CandidatID) references Candidates(Id) 
go


create nonclustered index IX_Employer_ContactPersons_EmployerId on Employer_ContactPersons
       (EmployerId asc)
go


create nonclustered index IX_Employer_ContactPersons_CandidatId on Employer_ContactPersons
       (CandidatID asc)
go
